package com.boot_reggie.Service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.boot_reggie.Dao.EmployeeMapper;
import com.boot_reggie.Service.EmployeeService;
import com.boot_reggie.domain.Employee;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceimpl extends ServiceImpl<EmployeeMapper, Employee>implements EmployeeService {
    @Autowired
    public EmployeeMapper employeeMapper;
    @Override
    public IPage<Employee> getPage(IPage page, String name) {
        LambdaQueryWrapper<Employee> lambdaQueryWrapper = new LambdaQueryWrapper();
        lambdaQueryWrapper.select(Employee::getUsername,Employee::getName,Employee::getPhone,Employee::getStatus,Employee::getId);
        lambdaQueryWrapper.ne(Employee::getId,1);
        lambdaQueryWrapper.like(Strings.isNotEmpty(name),Employee::getName,name); //判断是否有无名字和筛选

        return employeeMapper.selectPage(page, lambdaQueryWrapper);
    }


}
